package com.qf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.dao.StudentMapper;
import com.qf.entity.Student;
import com.qf.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public PageInfo<Student> findPage(int pageNum,int pageSize) {
        //设置分页参数
        PageHelper.startPage(pageNum,pageSize);

        List<com.qf.entity.Student> students = studentMapper.findAll();

        return new PageInfo<>(students);
    }

}
